<template>
  <ViewIframe :url="fileUrl" :height="height" :dataJson="dataJson" :selectFile="fileId"/>
</template>
<script lang="js" setup>
import ViewIframe from "@/components/viewIframe/index.vue"

import { ref, onMounted } from 'vue'
import { useRoute } from 'vue-router'

const 隐私政策_ = import.meta.env.VITE_CAS_URL + "/html/document/static/pdf/隐私政策_20241107.pdf";
const 隐私政策_20240613 = import.meta.env.VITE_CAS_URL + "/html/document/static/pdf/隐私政策_20240613.pdf";

const 隐私政策摘要_ = import.meta.env.VITE_CAS_URL + "/html/document/static/pdf/隐私政策摘要_20240408.pdf";
const 服务协议_ = import.meta.env.VITE_CAS_URL + "/html/document/static/pdf/服务协议_20240408.pdf";
const 用户管理规则及公约_ = import.meta.env.VITE_CAS_URL + "/html/document/static/pdf/用户管理规则及公约_20240408.pdf";
const 个人信息收集清单_ = import.meta.env.VITE_CAS_URL + "/html/document/static/pdf/个人信息收集清单_20240408.pdf";

const dataJson = {
  隐私政策: [
    {
      label: '2024-11-07',
      value: 0,
      url: 'https://help.qdama.cn/helpcenter/pcViewcommon?catalogid=686&shareby=85&md5password=D46453709778E2CCC5DB2C0245A66EC1', // -- 1107
      file: 隐私政策_,
    },
    {
      label: '2024-06-13',
      value: 1,
      url: 'https://help.qdama.cn/helpcenter/pcViewcommon?catalogid=507&shareby=85&md5password=D3802DA699A62D35E144E26C26C29EAF', // -- 0613
      file: 隐私政策_20240613,
    }
  ],
  隐私政策摘要: {
    url: 'https://help.qdama.cn/helpcenter/pcViewcommon?catalogid=498&shareby=85&md5password=3BCC455F199561E0086F6C4BC836FAF5',
    file: 隐私政策摘要_,
  },
  服务协议: {
    url: 'https://help.qdama.cn/helpcenter/pcViewcommon?catalogid=504&shareby=85&md5password=E216F0AC84E24F235EAE3542834339C7',
    file: 服务协议_,
  },
  用户管理规则及公约: {
    url: 'https://help.qdama.cn/helpcenter/pcViewcommon?catalogid=502&shareby=85&md5password=6655347237C7E7A5D1F5ED47762988A9',
    file: 用户管理规则及公约_,
  },
  个人信息收集清单: {
    url: 'https://help.qdama.cn/helpcenter/pcViewcommon?catalogid=503&shareby=85&md5password=CBE3EF3826D6E8EDF1B0C1B27C15E316',
    file: 个人信息收集清单_,
  },
}

const fileId = ref()
const route = useRoute()
const fileUrl = ref("")
const height = ref(0)

// 文档类型
const officeTypeVal = ref()

// 显示类型
const showType = ref()

// 在组件加载时获取路由参数，并根据参数加载对应的文件内容
onBeforeMount(()=>{

    fileId.value = route.params.id || 1

    if(fileId.value == '隐私政策'){
      height.value = 48
      fileUrl.value = dataJson[fileId.value][0]['url']
    }else{
      height.value = 0
      fileUrl.value = dataJson[fileId.value]['url']
    }

    officeTypeVal.value = route.params.officeType || "w"
    showType.value = officeTypeVal.value

})
onMounted(() => {})
</script>
